<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
	<canvas id="canvas" width="500" height="500" style="border:1px solid #000"></canvas>

</body>
</html>

<script type="text/javascript">
	var canvas = document.getElementById('canvas');
	var context = canvas.getContext('2d');
	//画一个矩形//
	context.fillStyle= 'red';
	context.fillRect(0,0,250,100);
	
	context.fillStyle= 'cyan';
	//旋转平移矩形 可以理解成transform（）是rotate translate scale的集成//
	context.transform(1,0.5,-0.5,1,30,10);
	context.fillRect(0,0,250,100)

	context.transform(1,0.5,-0.5,1,30,10);
	context.fillStyle='pink';
	context.fillRect(0,0,250,100)

</script>